async function user_info(ctx, next) {
    let id = ctx.params.id;
    if (id === '12345') {
        ctx.body = {
            id: 123456,
            email: 'admin@example.com',
            name: 'Bob'
        }
    } else {
        ctx.body = {
            error: 'USER_NOT_FOUND'
        }
    }
}

async function signin(ctx, next) {
    let email = ctx.request.body.email || '';
    let password = ctx.request.body.password || '';
    if (email === 'admin@example.com' && password === '123456') {
        console.log('sigin ok!');
        ctx.body = {
            id: 12345,
            email: email,
            name: 'Bob'
        };
    } else {
        console.log('signin failed!')
        ctx.body = {
            error:'SIGNIN_FAILED'
        }
    }
}

export default {
    'POST /api/signin': signin,
    'GET /api/users/:id': user_info
}